<template>
	<view class="staff-warp">
		<view class="staff-list" v-for="(item,index) in list" :key="index" @click="jumpDetail(item)">
			<view class="staff-left">
				<view class="staff-top-left">
					<image :src="item.img ? item.img : BASE_IMG_URL+'headImg.png'" class="headerimg"  mode="scaleToFill"></image>
					<view class="staff-name">{{item.name}}</view>
				</view>
				<view class="staff-post">岗位：{{item.post ? item.post : '--'}}</view>
			</view>
			<view class="staff-right">
				<view class="staff-mobile">手机号：{{item.mobile ? item.mobile : '--'}}</view>
				<view class="staff-super">直属上级：{{item.parent_name ? item.parent_name : '--'}}</view>
			</view>
		</view>
		<view style="height: 200rpx;"></view>
				<u-empty v-if="list.length == 0" text="暂无更多"></u-empty>
	</view>
</template>

<script>
	import { netStaffList } from '@/api/index.js'
	import { BASE_IMG_URL } from '@/util/api.js'
	export default{
		data(){
			return{
				BASE_IMG_URL:BASE_IMG_URL,
				list:[
					//测试数据需要清空
					{
						name:'name',
						post:'post',
						mobile:'mobile',
						parent_name:'parent_name'
					}
				]
			}
		},
		onLoad() {
			this.getList()
		},
		methods:{
			getList() {
				netStaffList().then(res=>{
					this.list = res.data
				})
			},
			jumpDetail(item) {
				uni.navigateTo({
					url:'/pages/profile/staff/stafflist/staffDetail?id='+item.id
				})
			}
		}
	}
</script>

<style scoped lang="scss">
	.staff-warp{
		padding:30rpx 0;
	}
	.staff-list{
		margin: 0 30rpx;
		background-color: #fff;
		padding: 30rpx;
		margin-bottom: 20rpx;
		border-radius: 10rpx;
		box-shadow: 2rpx 2rpx 50rpx rgba(0,0,0,0.1);
		display: flex;
		justify-content: space-between;
		align-items: center;
		.staff-left{
			.staff-top-left{
				display: flex;
				justify-content: flex-start;
				align-items: center;
				margin-bottom:20rpx;
				font-size:26rpx;
				color:#666;
				.headerimg{
					width:46rpx;
					height:46rpx;
					border-radius: 50%;
					margin-right:15rpx;
				}
			}
			.staff-post{
				font-size:26rpx;
				color:#666;
			}
		}
		.staff-right{
			flex-shrink: 0;
			font-size:26rpx;
			color:#666;
			.staff-mobile{
				margin-bottom:20rpx;
			}
		}
	}
</style>
